%%{init: {'themeVariables': { 'fontSize': '12px'}}}%%
graph TD
    classDef path fill:#eee,stroke:#000,color:#000
    classDef plan fill:#fff,stroke-width:1px,color:#000
    classDef itemplan fill:#fff,stroke-width:2px,color:#000
    classDef unbatchedplan fill:#dff,stroke-width:1px,color:#000
    classDef sideeffectplan fill:#fcc,stroke-width:2px,color:#000
    classDef bucket fill:#f6f6f6,color:#000,stroke-width:2px,text-align:left

    subgraph "Buckets for queries/interfaces-single-table/relation"
    Bucket0("Bucket 0 (root)<br /><br />1: <br />ᐳ: 8, 9, 112, 10<br />2: PgSelect[7]<br />3: PgSelectRows[12]<br />ᐳ: 11, 13, 14, 16, 17, 18<br />4: PgSelect[19]<br />5: PgSelectRows[24]<br />ᐳ: 23, 25, 64, 65, 71<br />6: PgSelect[72]<br />7: PgSelectRows[77]<br />ᐳ: First[76], PgSelectSingle[78]"):::bucket
    Bucket1("Bucket 1 (polymorphic)<br />__typename: Lambda[17]<br />Deps: 17, 65, 78, 13, 14, 25, 18"):::bucket
    Bucket2("Bucket 2 (polymorphic)<br />__typename: Lambda[65]<br />Deps: 65, 78, 25, 18"):::bucket
    Bucket3("Bucket 3 (nullableBoundary)<br />Deps: 78<br /><br />ROOT PgSelectSingleᐸpeopleᐳ[78]"):::bucket
    end
    Bucket0 --> Bucket1
    Bucket1 --> Bucket2
    Bucket2 --> Bucket3

    %% plan dependencies
    PgSelect7[["PgSelect[7∈0] ➊<br />ᐸsingle_table_itemsᐳ<br />More deps:<br />- Constantᐸ15ᐳ[112]"]]:::plan
    Object10{{"Object[10∈0] ➊<br />ᐸ{pgSettings,withPgClient}ᐳ"}}:::plan
    Object10 --> PgSelect7
    Access8{{"Access[8∈0] ➊<br />ᐸ2.pgSettingsᐳ"}}:::plan
    Access9{{"Access[9∈0] ➊<br />ᐸ2.withPgClientᐳ"}}:::plan
    Access8 & Access9 --> Object10
    PgSelect19[["PgSelect[19∈0] ➊<br />ᐸsingle_table_itemsᐳ"]]:::plan
    PgClassExpression18{{"PgClassExpression[18∈0] ➊<br />ᐸ__single_t...parent_id”ᐳ"}}:::plan
    Object10 & PgClassExpression18 --> PgSelect19
    PgSelect72[["PgSelect[72∈0] ➊<br />ᐸpeopleᐳ"]]:::plan
    PgClassExpression71{{"PgClassExpression[71∈0] ➊<br />ᐸ__single_t...author_id”ᐳ"}}:::plan
    Object10 & PgClassExpression71 --> PgSelect72
    __Value2["__Value[2∈0] ➊<br />ᐸcontextᐳ"]:::plan
    __Value2 --> Access8
    __Value2 --> Access9
    First11{{"First[11∈0] ➊"}}:::plan
    PgSelectRows12[["PgSelectRows[12∈0] ➊"]]:::plan
    PgSelectRows12 --> First11
    PgSelect7 --> PgSelectRows12
    PgSelectSingle13{{"PgSelectSingle[13∈0] ➊<br />ᐸsingle_table_itemsᐳ"}}:::plan
    First11 --> PgSelectSingle13
    PgClassExpression16{{"PgClassExpression[16∈0] ➊<br />ᐸ__single_t...s__.”type”ᐳ"}}:::plan
    PgSelectSingle13 --> PgClassExpression16
    PgSelectSingle13 --> PgClassExpression18
    First23{{"First[23∈0] ➊"}}:::plan
    PgSelectRows24[["PgSelectRows[24∈0] ➊"]]:::plan
    PgSelectRows24 --> First23
    PgSelect19 --> PgSelectRows24
    PgSelectSingle25{{"PgSelectSingle[25∈0] ➊<br />ᐸsingle_table_itemsᐳ"}}:::plan
    First23 --> PgSelectSingle25
    PgClassExpression64{{"PgClassExpression[64∈0] ➊<br />ᐸ__single_t...s__.”type”ᐳ"}}:::plan
    PgSelectSingle25 --> PgClassExpression64
    PgSelectSingle25 --> PgClassExpression71
    First76{{"First[76∈0] ➊"}}:::plan
    PgSelectRows77[["PgSelectRows[77∈0] ➊"]]:::plan
    PgSelectRows77 --> First76
    PgSelect72 --> PgSelectRows77
    PgSelectSingle78{{"PgSelectSingle[78∈0] ➊<br />ᐸpeopleᐳ"}}:::plan
    First76 --> PgSelectSingle78
    PgClassExpression111{{"PgClassExpression[111∈3] ➊<br />ᐸ__people__.”username”ᐳ<br />(5) ...ᐳSingleTableTopic<br />(5) ...ᐳSingleTablePost<br />(5) ...ᐳSingleTableDivider<br />(5) ...ᐳSingleTableChecklist<br />(5) ...ᐳSingleTableChecklistItem"}}:::plan
    PgSelectSingle78 --> PgClassExpression111

    %% define steps
    classDef bucket0 stroke:#696969
    class Bucket0,__Value2,PgSelect7,Access8,Access9,Object10,First11,PgSelectRows12,PgSelectSingle13,PgClassExpression16,PgClassExpression18,PgSelect19,First23,PgSelectRows24,PgSelectSingle25,PgClassExpression64,PgClassExpression71,PgSelect72,First76,PgSelectRows77,PgSelectSingle78 bucket0
    classDef bucket1 stroke:#00bfff
    class Bucket1 bucket1
    classDef bucket2 stroke:#7f007f
    class Bucket2 bucket2
    classDef bucket3 stroke:#ffa500
    class Bucket3,PgClassExpression111 bucket3

